﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoodsInvoicing.BLL.Service;
using GoodsInvoicing.DAL.DAO.UserRole;
using GoodsInvoicing.Model.UserRole;

namespace GoodsInvoicing.BLL.ServiceImpl
{
    public class GI_UserService : IGI_UserService
    {
        private GI_UserDAO userDAO;
        public GI_UserDAO GI_UserDAO 
        { 
            get { return userDAO; }
            set { userDAO = value; }
        }

        public GI_User Get(int userID)
        {
            return userDAO.Get(userID);
        }

        public IList<GI_User> GetAll()
        {
            return userDAO.GetAll();
        }

        public int Save(GI_User user)
        {
            return userDAO.Save(user);
        }

        public void Update(GI_User user)
        {
            userDAO.Update(user);
        }

        public void Delete(GI_User user)
        {
            userDAO.Delete(user);
        }


        public bool Login(string loginName, string loginPWD)
        {
            GI_User user = userDAO.Get(loginName, loginPWD);
            if (user != null)
                return true;
            else
                return false;
        }


        public IList<GI_User> Search(GI_User user)
        {
            return userDAO.Search(user);
        }
    }
}
